package test01;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

public class DamoHash {
    public static void main(String[] args) {

        Student st1=new Student("huyong",21);
        Student st2=new Student("zhanggy",22);
        Student st3=new Student("zhangxq",35);
        HashMap<Student,String> hm=new HashMap<>();
        hm.put(st1,"黑龙江");
        hm.put(st2,"吉林");
        hm.put(st3,"北京");
        for (Map.Entry<Student, String> studentStringEntry : hm.entrySet()) {
            System.out.println(studentStringEntry.getKey()+"---------------"+studentStringEntry.getValue());
            
        }


        //extracted();


    }

    private static void extracted() {
        HashSet<Student> hs=new HashSet<>();

        Student st1=new Student("huyong",27);
        Student st2=new Student("zhanggy",25);
        Student st3=new Student("huyong",27);
        hs.add(st1);
        hs.add(st2);
        hs.add(st3);
        for (Student h : hs) {
            System.out.println(h);
            
        }
    }
}
